<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function isSuanZi(str) {
            if (str.length != 6) {
                return false;
            }
            if (str.length == 6) {
                var s1 = str[0];
                var s2 = str[1];
                var s3 = str[2];
                var s4 = str[3];
                var s5 = str[4];
                var s6 = str[5];
                if (s1 =s2 && s3 ==s4 && s5 ==s6 &&s3-s2==s5-s4 ) {
                    return true;

                } else {
                    return  1;
                }
            }
        };
        var str=prompt("请输入数：");
         
          alert( isSuanZi(str));


    </script>


</body>

</html>